package aierjun.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import aierjun.bean.UserBean;
import aierjun.utils.ConnectionUtils;



public class UserDao {
	public int rs;
	public static final String FIND_ALL_EMP = "insert into username values(?) ";
	public int saveSQL(UserBean userBean){
		Connection conn = null;
		PreparedStatement stmt = null;
		try {
			conn = ConnectionUtils.getConnection();
			stmt = conn.prepareStatement(FIND_ALL_EMP);
	        stmt.setObject(1, userBean.getUname());
	        rs = stmt.executeUpdate();
	        System.out.println(rs+"");
	        if (rs!=0) {
				System.out.println("OK");
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally {
			try {
				stmt.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return rs;
	}
}
